package com.chj.comp.common.rabbitmq.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum MsgStatusEnum {

    STATUS_0("0", "初始"),
    STATUS_1("1", "已发送(已成功发送至rabbitmq)"),
    STATUS_2("2", "已确认(消费者已确认收到)"),
    STATUS_3("3", "已消费");

    private final String status;
    private final String desc;


    public static MsgStatusEnum getMsgStatus(String status) {
        return Arrays.asList(values()).stream()
                .filter((o) -> {
                    return o.getStatus().equals(status);
                })
                .findFirst()
                .orElse(null);
    }
}
